package com.yuanfeng.base.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanfeng.base.entity.BaseDealerSetEntity;
import com.yuanfeng.base.mapper.BaseDealerSetMapper;
import com.yuanfeng.base.service.BaseDealerSetService;
import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.commoms.vo.base.DealerSetVO;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @ClassName BaseDealerSetServiceImpl
 * @Description 供应商配置项
 * @Author cyp
 * @Date 2023-05-31 14:07:50
 * @Version 1.0
 **/
@Service
public class BaseDealerSetServiceImpl extends ServiceImpl<BaseDealerSetMapper, BaseDealerSetEntity>
        implements BaseDealerSetService {
    @Override
    public ResponseResult settingDistribute() {
        DealerSetVO result= this.baseMapper.settingDistribute("commission_setting");
        return ResponseResult.success(result);
    }

    @Override
    public ResponseResult settingDistributeUpdate(Map<String, Object> map) {
        BaseDealerSetEntity dealerSetEntity = JSONObject.parseObject(JSON.toJSONString(map), BaseDealerSetEntity.class);
        this.baseMapper.updateById(dealerSetEntity);
        return ResponseResult.success();
    }
}
